package cn.iocoder.yudao.module.mp.dal.mysql.user;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mp.controller.admin.user.vo.UserPageReqVO;
import cn.iocoder.yudao.module.mp.dal.dataobject.user.UserDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 小程序端用户 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserMapper extends BaseMapperX<UserDO> {

    default PageResult<UserDO> selectPage(UserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserDO>()
                .eqIfPresent(UserDO::getOpenId, reqVO.getOpenId())
                .likeIfPresent(UserDO::getNickName, reqVO.getNickname())
                .betweenIfPresent(UserDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserDO::getId));
    }

}